import 'package:bloc/bloc.dart';
import 'package:qgchat/http/apis/common.dart';
import 'package:qgchat/http/models/dongtaiInfoModel.dart';

enum DynamicEvent { refresh }

class DynamicBloc extends Bloc<DynamicEvent, DongtaiInfoModel> {
  DynamicBloc(this.id);

  final int id; // 动态id
  
  @override
  DongtaiInfoModel get initialState => DongtaiInfoModel();

  @override
  Stream<DongtaiInfoModel> mapEventToState(DynamicEvent event) async* {
    switch (event) {
      // 刷新
      case DynamicEvent.refresh:
        DongtaiInfoModel info = await CommonApis.dongtaiInfo(id);
        yield info;
        break;
    }
  }

}